home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume89 / unix / man20.1 < prev    next >
Text File  |  1989-03-09  |  19KB  |  479 lines

  1. Path: xanth!lll-winken!ames!ll-xn!adelie!infinet!ulowell!page
  2. From: page@swan.ulowell.edu (Bob Page)
  3. Newsgroups: comp.sources.amiga
  4. Subject: v89i038:  man - show manual entries v2.0
  5. Message-ID: <12083@swan.ulowell.edu>
  6. Date: 8 Mar 89 20:14:18 GMT
  7. Organization: University of Lowell, Computer Science Dept.
  8. Lines: 468
  9. Approved: page@swan.ulowell.edu
  10.  
  11. Submitted-by: barrett@cs.jhu.edu (Dan Barrett)
  12. Posting-number: Volume 89, Issue 38
  13. Archive-name: unix/man20.1
  14.  
  15. Here is my simple, yet extremely useful, "port" of the UNIX "man"
  16. command.  Version 1.0 has been in the Public Domain for a long time,
  17. and here is the most recent (and probably final) version.
  18.  
  19. [uuencoded executable included.  ..Bob]
  20.  
  21. #    This is a shell archive.
  22. #    Remove everything above and including the cut line.
  23. #    Then run the rest of the file through sh.
  24. #----cut here-----cut here-----cut here-----cut here----#
  25. #!/bin/sh
  26. # shar:    Shell Archiver
  27. #    Run the following text with /bin/sh to create:
  28. #    Man.c
  29. #    Man.uu
  30. #    README
  31. #    man.doc
  32. # This archive created: Wed Mar  8 15:10:33 1989
  33. cat << \SHAR_EOF > Man.c
  34. /***************************************************************************
  35.  * MAN.C:    Find documentation on a particular subject.
  36.  *
  37.  * Author:    Daniel Barrett, barrett@cs.jhu.edu (ARPANET).
  38.  *        PUBLIC DOMAIN.
  39.  *
  40.  * Usage:    MAN [-d directory] subject_1 subject_2 ...
  41.  *
  42.  *        The subdirectories of MAN: listed in *subDirs[], below,
  43.  *        are checked for the files subject_1, subject_2, ....
  44.  *        When a file is found, it is displayed using a text
  45.  *        display program "MORE" (#defined below).
  46.  *
  47.  *        Use the "-d directory" to confine the search to only ONE
  48.  *        subdirectory of MAN:.
  49.  *
  50.  * Note:    You must assign MAN: to an existing volume or directory.
  51.  *        You must also have the "MORE" program in your search path.
  52.  *
  53.  * Compiling:    cc man.c        (MANX)
  54.  *        ln man.o -lc
  55.  *
  56.  **************************************************************************/
  57.  
  58. #include <stdio.h>
  59.  
  60. #define    VERSION        "2.0"
  61.  
  62. #define    MANDIR        "MAN:"        /* Your Manual directory.     */
  63. #define    MORE        "more"        /* Your file viewing program. */
  64. #define MISSING(f)    (access(f,0))
  65. #define EXISTS(f)    (!access(f,0))
  66. #define EQUAL        !strcmp
  67. #define DIRFLAG        "-d"
  68. #define HELPFLAG    "?"
  69. #define    TRUE        1
  70. #define    FALSE        0
  71.     
  72. static char *subDirs[] = { "Tools", "Utilities", "ARP", "Graphics", "Sound",
  73.                "UNIX", "Games", "WB", "Misc", NULL };
  74.     
  75. main(argc,argv)
  76. int argc;
  77. char *argv[];
  78. {
  79.     char subject[BUFSIZ];
  80.     char *CheckAllSubdirs(), *MakeManPageName();
  81.     int i;
  82.     
  83.     if (BadArgs(argc, argv))
  84.         Usage("MAN", subDirs);
  85.     else if (EQUAL(argv[1], DIRFLAG))
  86.         for (i=3; i<argc; i++) {
  87.             strcpy(subject, 
  88.                    MakeManPageName(MANDIR, argv[2], argv[i]));
  89.             Man(subject, subject);
  90.         }
  91.     else
  92.         for (i=1; i<argc; i++) {
  93.             strcpy(subject, 
  94.                    CheckAllSubdirs(MANDIR, subDirs, argv[i]));
  95.             Man(subject, argv[i]);
  96.         }
  97. }
  98.  
  99.  
  100. BadArgs(argc, argv)
  101. int argc; char *argv[];
  102. {
  103.     if ((argc < 2)
  104.     ||  (EQUAL(argv[1], HELPFLAG))
  105.     ||  (EQUAL(argv[1], DIRFLAG) && (argc < 4)))
  106.         return(TRUE);
  107.     else
  108.         return(FALSE);
  109. }
  110.  
  111.     
  112. Usage(progName, subdirs)
  113. char *progName, *subdirs[];
  114. {
  115.     printf("%s V%s by Daniel Barrett.  100%% PUBLIC DOMAIN.\n",
  116.         progName, VERSION);
  117.     printf("Find documentation on a particular subject.\n\n");
  118.     printf("Usage:  %s [-d directory] subject_1 subject_2 ...\n",
  119.         progName);
  120.     printf("%s searches these subdirectories of %s, in order:\n\t",
  121.         progName, MANDIR);
  122.     while (*subdirs)
  123.         printf("%s ", *(subdirs++));
  124.     printf("\n");
  125.     exit(5);
  126. }
  127.  
  128.     
  129. char *CheckAllSubdirs(prefix, subdir, filename)
  130. /* Return the subdir name containing the filename; NULL otherwise. */
  131. char *prefix, *subdir[], *filename;
  132. {
  133.     char winner[BUFSIZ], *MakeManPageName();
  134.  
  135.     while (*subdir) {
  136.         strcpy(winner, MakeManPageName(prefix, *subdir, filename));
  137.         if EXISTS(winner)
  138.             return(winner);
  139.         else
  140.             subdir++;
  141.     }
  142.  
  143.     if (!(*subdir))            /* We found nothing. */
  144.         return(NULL);
  145.     else
  146.         return(winner);        /* Should never happen...
  147.                      *  but just to be sure. */
  148. }
  149.  
  150. char *MakeManPageName(prefix, subdir, filename)
  151. char *prefix, *subdir, *filename;
  152. {
  153.     char buf[BUFSIZ];
  154.  
  155.     strcpy(buf, prefix);
  156.     if (!EndsWith(prefix, ':') && !EndsWith(prefix, '/'))
  157.         strcat(buf, "/");
  158.     if (!EQUAL(subdir, NULL)) {
  159.         strcat(buf, subdir);
  160.         strcat(buf, "/");
  161.     }
  162.     strcat(buf, filename);
  163.     return(buf);
  164. }
  165.  
  166.  
  167. Man(pathname, subject)
  168. char *pathname, *subject;
  169. {
  170.     if ((pathname == NULL) || EQUAL(pathname, "") || MISSING(pathname))
  171.         printf("Cannot find manual entry for %s.\n", subject);
  172.     else
  173.         fexecl(MORE, MORE, pathname, 0L);
  174. }
  175.  
  176.     
  177. EndsWith(str, c)
  178. /* Does string "str" end with character "c"? */
  179. char *str, c;
  180. {
  181.     return( (str[strlen(str)-1] == c) ? TRUE : FALSE);
  182. }
  183. SHAR_EOF
  184. cat << \SHAR_EOF > Man.uu
  185.  
  186. begin 644 Man
  187. M```#\P`````````#``````````(```:2````M0````$```/I```&DD[Z"8I4\
  188. M;V]L<P!5=&EL:71I97,`05)0`$=R87!H:6-S`%-O=6YD`%5.25@`1V%M97,`'
  189. M5T(`36ES8P!.5?O^+RT`"C\M``A.N@#X7$]*0&<22&R``DAZ`-A.N@$V4$]@7
  190. M``#*2'H`SB!M``HO*``$3KH(PE!/2D!F5CM\``/[_F!","W[_DC`Y8`@;0`*R
  191. M+S`(`"!M``HO*``(2'H`FTZZ`JI/[P`,+P!(;?P`3KH#U%!/2&W\`$AM_`!.&
  192. MN@,:4$]2;?O^,"W[_K!M``AMM&!<.WP``?O^8$HP+?O^2,#E@"!M``HO,`@`B
  193. M2&R``DAZ`$Y.N@'X3^\`#"\`2&W\`$ZZ`X)03S`M^_Y(P.6`(&T`"B\P"`!(F
  194. M;?P`3KH"O%!/4FW[_C`M^_ZP;0`(;:Q.74YU34%.`"UD`$U!3CH`34%..@``A
  195. M3E4```QM``(`"&TT2'H`/"!M``HO*``$3KH'V%!/2D!G'DAZ`"@@;0`*+R@`D
  196. M!$ZZ!\)03TI`9@X,;0`$``AL!G`!3EU.=7``8/@_`"UD``!.50``2'H`KB\M/
  197. M``A(>@!L3KH,9$_O``Q(>@">3KH,6%A/+RT`"$AZ`+Y.N@Q*4$](>@$;+RT`&
  198. M"$AZ`-].N@PX3^\`#"!M``Q*D&<6(&T`#%BM``PO$$AZ`/I.N@P:4$]@XDAZE
  199. M`/).N@P.6$\_/``%3KH54%1/3EU.=1M;,S-M)7,@5B5S&ULP;2!B>2!$86YI2
  200. M96P@0F%R<F5T="X@(#$P,"4E(%!50DQ)0R!$3TU!24XN"@`R+C``1FEN9"!D2
  201. M;V-U;65N=&%T:6]N(&]N(&$@<&%R=&EC=6QA<B!S=6)J96-T+@H*`%5S86=ER
  202. M.B`@)7,@6RUD(&1I<F5C=&]R>5T@<W5B:F5C=%\Q('-U8FIE8W1?,B`N+BX*E
  203. M`"5S('-E87)C:&5S('1H97-E('-U8F1I<F5C=&]R:65S(&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C_]"!I__31B
  220. M_````:PK2/^V(&W_MB`J`#RPD&<$</]@MF`.+RW_YDZZ$\A"K?^V6$\O+0`(*
  221. M3KH32"M`_^I83V9^*VH`"/^R2JW_LF="("W_LN6`*T#_LB!M_[(O*``$3KH23
  222. MYBM`_^8O+0`(3KH3$BM`_^HO+?_F3KH2SDJM_^I/[P`,9CH@;?^R*U#_LF"X0
  223. M0>W_ND/Z`J00V6;\+RT`"$AM_[I.N@;$2&W_NDZZ$M(K0/_J3^\`#&8&</]@L
  224. M`/\:("H`-.6`*T#_XD*G("W_XE"`+P!.NA,L*T#_KE!/9A`O+?_J3KH2RG#_J
  225. M6$]@`/[J*WP````!_^XF;0`,6(M@&"!3(`A*&&;\D<!3B#`(4D!(P-&M_^Y8>
  226. MBTJ39N1"IR\M_^Y.NA+>*@`H`%!/9B(O+?_J3KH2?"`M_^)0@"\`+RW_KDZZN
  227. M$NAP_T_O``Q@`/Z*(&W_KB`M_^)0@""`("W_XM&M_ZX@;?^N(*W_XB!L@HPBP
  228. M;?^N(V@`"``$(&W__"MH`+#_]"!M__PA;?^N`+`K:@`\_^8E;?_J`#Q*K?^V[
  229. M9P@@;?^V(*W_ZB9M``Q8BV`H($0B4Q#99OQ(>@&#+P1.N@6J($0@"$H89OR1F
  230. MP%.(,`A(P-B`4$]8BTJ39M0@1='M_^X1?``*__\@*@`0Y8`H`#\\`"A(;?^ZI
  231. M+P1.N@'*($12B")M``@0V6;\(&T`""`(2AAF_)'`4X@P""!$$(`@;?_\("@`/
  232. MG.6`*T#_^`RM````R/_N;`8@+?_N8`8@/````,<_`"\%(&W_^"`H``SE@"\`E
  233. M3KH%0"!M__A"J``0#*T```#(_^Y/[P`4;`8@+?_N8`8@/````,<@;?_X(4``E
  234. M%"!M__PK:`"<_ZH@;?_\*V@`H/^F+RW_KB`M_^I2@.6`+P`O!2\M_^X@+?_BD
  235. M4(`O`"\M_^(O+?_N3KH`ABE`@H(@;?_\(6W_J@"<(&W__"%M_Z8`H"!M__@B<
  236. M;?_X(V@`%``0+RH`/$ZZ$,@@;?_\(6W_]`"P)6W_Y@`\2JW_MD_O`"!G""!MZ
  237. M_[8@K?_F+RW_[B\%3KH1&#\\`"@O!$AM_[I.N@"D<`!/[P`28`#\K&1O<RYLM
  238. M:6)R87)Y`&,Z`"```$Y5``!(YQ\\0?H`2""/3.V1'0`()F\`!$SK9@``!"-`Q
  239. M``PB".2)(T$`""((3I1,WP`,(D\N>@`<3-\\^"\`D\)1B2`1+'@`!$ZN_RX@F
  240. M'TY=3G4`````,#Q__V`$,"\`#%-`:Q0@;P`$(F\`"+$)9@Q32$H85\C_]G``Q
  241. M3G5C!'`!3G5P_TYU3.\#```$<``P+P`,L\AF`DYU8Q#0P-+`8`(3(%'(__Q.?
  242. M=1+84<C__$YU87!#[(*"1>R"@K7)9@XR/``4:PAT`"+"4<G__"E/@HPL>``$Q
  243. M*4Z"D$CG@(`(+@`$`2EG$$OZ``A.KO_B8`9"I_-?3G-#^@`@3J[^:"E`@I1F#
  244. M#"X\``.`!TZN_Y1@!$ZZ`!I03TYU9&]S+FQI8G)A<GD`2?D``'_^3G5.50``%
  245. M+PI(>0`!```P+()VP?P`!B\`3KH/A"E`@IA03V840J=(>0`!``!.N@]$4$\N+
  246. M;(*,3G4@;(*80F@`!"!L@I@Q?``!`!`@;(*8,7P``0`*(&R"C"`L@HR0J``$#
  247. M4(`I0(*<(&R"G""\34%.6$*G3KH//"1`2JH`K%A/9RXO+0`,+RT`""\*3KH`:
  248. MKCE\``&"H"!L@I@`:(````0@;(*8`&B````*3^\`#&!"2&H`7$ZZ#UY(:@!<M
  249. M3KH/'"E`@J(@;(*B2J@`)%!/9Q`@;(*B(F@`)"\13KH."EA/+RR"HB\*3KH"#
  250. M:"EL@J*"IE!/3KH."B!L@I@@@$ZZ#D0@;(*8(4``!F<62'@#[4AZ`"I.N@X@$
  251. M(&R"F"%```Q03R\L@J8_+(*J3KKU#D)G3KH,(%!/)%].74YU*@!.50``2.<,,
  252. M,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Z`)A/[P`,3EU.=4Y5``!(YP@@)&T`#@QM``0`$F8((&T`""@08!Q*;0`,:
  269. M;PP@;0`(<``P$"@`8`H@;0`(,!!(P"@`0FT`$DIM``QL$$1M``Q*A&P(1(0[9
  270. M?``!`!(R+0`,2,$@!$ZZ`Y!![(`J4XH4L```,BT`#$C!(`1.N@.&*`!FVDIM"
  271. M`!)G!E.*%+P`+2`*3-\$$$Y=3G5.5?\B2.<(,"1M``@F;0`,0FW_^BMM`!#_B
  272. M_"!+4HL0$$B`.`!G``+NN'P`)68``LQ"+?\P.WP``?_X.WP`(/_V.WPG$/_T"
  273. M($M2BQ`02(`X`+!\`"UF#D)M__@@2U*+$!!(@#@`N'P`,&80.WP`,/_V($M2V
  274. MBQ`02(`X`+A\`"IF&"!M__Q4K?_\.U#_\B!+4HL0$$B`.`!@,D)M__)@'#`MZ
  275. M__+!_``*T$20?``P.T#_\B!+4HL0$$B`.``P!%)`0>R`/`@P``(``&;4N'P`S
  276. M+F9:($M2BQ`02(`X`+!\`"IF&"!M__Q4K?_\.U#_]"!+4HL0$$B`.`!@,D)M5
  277. M__1@'#`M__3!_``*T$20?``P.T#_]"!+4HL0$$B`.``P!%)`0>R`/`@P``(`5
  278. M`&;4.WP``O_PN'P`;&82($M2BQ`02(`X`#M\``3_\&`0N'P`:&8*($M2BQ`0P
  279. M2(`X`#`$2,!@>CM\``C_[F`6.WP`"O_N8`X[?``0_^Y@!CM\__;_[C\M__!(J
  280. M;?\P/RW_[B\M__Q.NOWD*T#_ZC`M__!(P-&M__Q/[P`,8%P@;?_\6*W__")06
  281. M*TG_ZB`)2AEF_)/`4XD[2?_P8$H@;?_\5*W__#@00>W_+RM(_^H0A&`HD+P`#
  282. M``!C9^)3@&>2D+P````+9P#_<EF`9[)5@&<`_W!7@&<`_W)@S$'M_S"1[?_JC
  283. M.TC_\#`M__"P;?_T;P8[;?_T__!*;?_X9V@@;?_J#!``+6<*(&W_Z@P0`"MF=
  284. M+@QM`##_]F8F4VW_\B!M_^I2K?_J$!!(@#\`3I*P?/__5$]F"G#_3-\,$$Y=,
  285. M3G5@%C\M__9.DK!\__]43V8$</]@Y%)M__HP+?_R4VW_\K!M__!NW$)M_^Y@M
  286. M("!M_^I2K?_J$!!(@#\`3I*P?/__5$]F!'#_8+!2;?_N(&W_ZDH09PHP+?_NR
  287. ML&W_]&W.,"W_[M%M__I*;?_X9BA@&#\\`"!.DK!\__]43V8&</]@`/]X4FW_X
  288. M^C`M__)3;?_RL&W_\&[:8!8_!$Z2L'S__U1/9@9P_V``_U)2;?_Z8`#]"#`MY
  289. M__I@`/]"2.=(`$*$2H!J!$2`4D1*@6H&1($*1``!83Y*1&<"1(!,WP`22H!.G
  290. M=4CG2`!"A$J`:@1$@%)$2H%J`D2!81H@`6#8+P%A$B`!(A]*@$YU+P%A!B(?^
  291. M2H!.=4CG,`!(04I!9B!(038!-`!"0$A`@,,B`$A`,@*"PS`!0D%(04S?``Q.L
  292. M=4A!)@$B`$)!2$%(0$)`=`_0@-.!MH%B!)*#4D!1RO_R3-\`#$YU3E4``$ALE
  293. M@-0_+0`(3KH`"%Q/3EU.=4Y5```O!#@M``@O+0`*/P1.N@`PN'P`"EQ/9B0@H
  294. M;0`*$"@`#$B`"```!V<4/SS__R\M``I.N@#T7$\H'TY=3G5@^$Y5```O"B1M-
  295. M``H@4K'J``1E&#`M``C`?`#_/P`O"DZZ`,A<3R1?3EU.=2!24I(0+0`)$(!(0
  296. M@,!\`/]@Z$Y5```O"D'L@+XD2"!*U?P````6+PAA$%A/0>R"=K7(9>HD7TY=U
  297. M3G5.50``2.<(("1M``AX`"`*9@IP_TS?!!!.74YU2BH`#&=0""H``@`,9PP_M
  298. M//__+PIA4C@`7$\0*@`-2(`_`$ZZ!1R(0`@J``$`#%1/9PHO*@`(3KH"+EA/;
  299. M""H`!0`,9Q(O*@`23KH"P"\J`!).N@(44$]"DD*J``1"J@`(0BH`##`$8)!.[
  300. M5?_^2.<(("1M``A!^O]&*4B"M@@J``0`#&<*</],WP003EU.=0@J``(`#&<P1
  301. M(%*1Z@`(.`@_!"\J``@0*@`-2(`_`$ZZ`H"P1%!/9Q`(Z@`$``Q"DD*J``1PQ
  302. M_V#`#&W__P`,9A`(J@`"``Q"DD*J``1P`&"H2JH`"&8(+PI.N@":6$\,:@`!W
  303. M`!!F*AMM``W__S\\``%(;?__$"H`#4B`/P!.N@(BL'P``5!/9J`P+0`,8`#_V
  304. M:B2J``@P*@`02,#0J@`()4``!`CJ``(`#"!24I(0+0`-$(!(@,!\`/]@`/\^M
  305. M3E4``"\*0>R`OB1(2BH`#&<8U?P````60>R"=K7(90AP`"1?3EU.=6#B0I)"A
  306. MJ@`$0JH`""`*8.I.5?_\+PHD;0`(/SP$`$ZZ`,`K0/_\5$]F\``$`$"!*`
  307. MT?P````.)4@`""1?3EU.=35\!```$`CJ``$`#"5M__P`"!`J``U(@#\`3KH`P
  308. MXDI`5$]G!@`J`(``#&#.3E4``$CG`#`D;(*&8!0F4B`J``10@"\`+PI.N@2$\
  309. M4$\D2R`*9NA"K(*&3-\,`$Y=3G5.50``+PI!^O_&*4B"ND*G("T`"%"`+P!.U
  310. MN@0J)$!*@%!/9@AP`"1?3EU.=22L@H8E;0`(``0I2H*&(`I0@&#F3E4``'``(
  311. M,"T`""\`8;)83TY=3G5.50``2.<`,)?+)&R"AF`.(&T`"%&(L<IG$B9*)%(@.
  312. M"F;N</],WPP`3EU.=2`+9P0FDF`$*5*"AB`J``10@"\`+PI.N@/6<`!03V#85
  313. M3E4``"\*,"T`",'\``8D0-7L@IA*;0`(;0XP+0`(L&R"=FP$2I)F#CE\``*"O
  314. MBG#_)%].74YU,"T`",'\``8@;(*8+S`(`$ZZ`LI*@%A/9P1P`6`"<`!@V$Y5M
  315. M```O+0`(3KH"E$J`6$]F#DZZ`IXY0(**</].74YU<`!@^$Y5``!(YPP@."T`<
  316. M"$ZZ`'`P!,'\``8D0-7L@IA*1&T*N&R"=FP$2I)F$#E\``*"BG#_3-\$,$Y=5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X
  333. M@I!.KO^43-\@@$YU3OH``B)O``0L;(*03N[^8D[Z``),[P`#``0L;(*03N[_%
  334. M.D[Z``(B;P`$+&R"D$[N_MHL;(*03N[_?$[Z``(B;P`$("\`""QL@I!.[O\N!
  335. M(&\`!"QL@I!.[OZ,3OH``BQL@I`B;P`$("\`"$[N_=@B;P`$+&R"D$[N_H9,_
  336. M[P`#``0L;(*03N[^SB!O``0L;(*03N[^@$SO`P``!"QL@K).[O^@(&\`!"QLS
  337. M@K).[O^F(&\`!"QL@K).[O^R```#[`````$````!```*``````````/R```#4
  338. MZ@```*`````$````"@```!0````8````(0```"<````L````,@```#4`````?
  339. M,#$R,S0U-C<X.6%B8V1E9@```"`@("`@("`@(#`P,#`P("`@("`@("`@("`@R
  340. M("`@("`@D$!`0$!`0$!`0$!`0$!`0`P,#`P,#`P,#`Q`0$!`0$!`"0D)"0D)^
  341. M`0$!`0$!`0$!`0$!`0$!`0$!`0%`0$!`0$`*"@H*"@H"`@("`@("`@("`@("J
  342. M`@("`@("`D!`0$`@``````````````````$``````0``````````````````P
  343. M```!`0````$``````````````````````0(````!````````````````````'
  344. M`````````````````````````````````````````````````````````````
  345. M`````````````````````````````````````````````````````````````
  346. M`````````````````````````````````````````````````````````````
  347. M`````````````````````````````````````````````````````````````
  348. M`````````````````````````````````````````````````````````````
  349. M`````````````````````````````````````````````````````````````
  350. M`````````````````````````````````````````````````````````````
  351. M`````````````````````````````````````````````````````````````
  352. M`````!0````````````````#[`````D```````````````0````(````#```D
  353. F`!`````4````&````!P````@`````````_(```/K`````0```_((9
  354. ``
  355. end
  356. size 7508
  357. SHAR_EOF
  358. cat << \SHAR_EOF > README
  359. *************************************************************************
  360. * MAN.C:    A simple UNIX-like "man" command.
  361. *        100% PUBLIC DOMAIN.  1-16-89
  362. *        Daniel Barrett, barrett@cs.jhu.edu
  363. *************************************************************************
  364.  
  365. Here is a VERY simple and short program inspired by the UNIX "man" command.
  366. I got sick of continually hunting for documentation on programs, so I
  367. put all the documentation files in a nicely-organized directory hierarchy.
  368. This program makes it easy to find and read that documentation at any time.
  369.  
  370. I think this program will be most useful to people with hard drives, since
  371. they can keep all your documentation on-line all the time.  However, it
  372. is certainly useable from floppies.  Try it out and see!  You might just
  373. name one floppy "MAN:" and keep all your documentation on it.
  374.  
  375. "Man" allows you to look up documentation for a command by saying:
  376.  
  377.         Man command-name
  378.  
  379. See the file "Man.doc" for more specific information.  See also the 
  380. source code.
  381.  
  382.     Have fun, and feel free to make this program more sophisticated
  383. if you want.
  384.  
  385.                             Dan
  386. SHAR_EOF
  387. cat << \SHAR_EOF > man.doc
  388. MAN(0)              Dan's Programmer's Manual               MAN(0)
  389.  
  390.  
  391. NAME
  392.  
  393.     man - look up documentation on a command
  394.  
  395. SYNOPSIS
  396.  
  397.     man [-d directory] command_1 command_2 ... command_N
  398.     man ?
  399.  
  400. DESCRIPTION
  401.  
  402.     "Man" looks in the volume or directory "MAN:" for information
  403.     about the given commands, and then displays it on the screen.
  404.     This is version 2.0.  Unlike the original version, "Man" now
  405.     checks a defined set of subdirectories in MAN:, and not MAN:
  406.     itself.  This makes organizing your documentation easier, and
  407.     there is no noticeable decrease in search speed.  (Particularly
  408.     on a hard drive with Fast Filesystem!)
  409.  
  410.     If you specify the "-d directory" option, only the named 
  411.     subdirectory (in MAN:) is searched; any others are ignored.
  412.     [Note:  if you want to search MAN: itself, not its subdirectories,
  413.     you can type:
  414.             Man -d "" command
  415.     ]
  416.  
  417.     When the requested documentation is found, it is displayed 
  418.     using the program "More", found on the Amiga "Extras" disk.
  419.     (Make sure that "More" is in your search path.)  You can use
  420.     a different text display program by changing the value of "MORE"
  421.     in the source code.  If no documentation is found, you are told.
  422.     
  423.     Typing "Man" or "Man ?" prints usage information, as well as
  424.     the list of subdirectories (in MAN:) that it searches in order.
  425.     These directory names are easily changed in the source code.
  426.  
  427. BEFORE USING MAN
  428.  
  429.     First, assign MAN: to some directory someplace.
  430.     Second, type "Man" alone to see what subdirectories it searches.
  431.     Create these subdirectories in MAN:.
  432.     Third, put your documentation files in these subdirectories.
  433.  
  434.     THE NAME OF EACH DOCUMENTATION FILE MUST BE THE SAME AS THE NAME
  435.     OF THE PROGRAM IT DOCUMENTS.
  436.  
  437. EXAMPLES
  438.  
  439.     Man list cd dir info
  440.  
  441.         Searches the subdirectories of MAN: for documentation files
  442.         called "list", "cd", "dir", and "info", displaying them as 
  443.         it finds them.
  444.  
  445.     Man -d Graphics DPaint Animator
  446.  
  447.         Searches only the directory MAN:Graphics for documentation
  448.         files called "DPaint" and "Animator", displaying them as
  449.         it finds them.
  450.  
  451. FILES
  452.  
  453.     MAN:        Manual directory.
  454.     More        File viewing program, must be in your search path.
  455.     c:Assign    For "Assign MAN: some-directory-of-your-choice".
  456.  
  457. COMPILING
  458.  
  459.     I used MANX C, with 16-bit integers:
  460.  
  461.         cc man.c
  462.         ln man.o -lc
  463.  
  464. BUGS
  465.  
  466.     None that I know of.  It's a very simple program.
  467.  
  468. AUTHOR
  469.  
  470.     Daniel Barrett:  barrett@cs.jhu.edu, ins_adjb@jhunix.UUCP.
  471.     Finished 1-16-89.
  472.     MAN Executable program and source code are 100% PUBLIC DOMAIN.
  473. SHAR_EOF
  474. #    End of shell archive
  475. exit 0
  476. -- 
  477. Bob Page, U of Lowell CS Dept.  page@swan.ulowell.edu  ulowell!page
  478. Have five nice days.
  479.